selection sort explenation and implementation